﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace blackhouse.NemoBlog.Business.Model {
    public class StandardPostModel : IPostModel {

        #region Fields
        #endregion

        #region Properties

        public NemoBlogPost Post {
            get;
            private set;
        }

        public NemoBlogSettings Settings {
            get;
            private set;
        }

        #endregion

        #region Constructors

        public StandardPostModel(int postId) {
            this.Post = new NemoBlogPost(postId);
            if (this.Post != null && this.Post.Exists)
                this.Settings = new NemoBlogSettings(this.Post.ModuleId);
        }

        #endregion

        public NemoBlogPost[] GetSimilarPosts() {
            if (this.Settings.UseSimilarPostsSystem)
                return NemoBlogPosts.GetSimilarPosts(this.Post.PostId, this.Settings.SimilarPostsCount, this.Settings.SimilarPostsDayAgo, this.Settings.SimilarPostsForwardDays);
            else
                return new NemoBlogPost[0];
        }
    }
}
